Add tests to check that swap(std::function, std::function) is noexcept. This is LWG#2062, but we already do this. No changes to the library, just adding tests. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@283780 91177308-0d34-0410-b5e6-96231b3b80d8 
diff --git a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.alg/swap.pass.cpp b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.alg/swap.pass.cpp index 58192c9..1a9206e 100644 --- a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.alg/swap.pass.cpp +++ b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.alg/swap.pass.cpp 
@@ -12,13 +12,14 @@  // class function<R(ArgTypes...)>    // template <MoveConstructible R, MoveConstructible ... ArgTypes> -// void swap(function<R(ArgTypes...)>&, function<R(ArgTypes...)>&); +// void swap(function<R(ArgTypes...)>&, function<R(ArgTypes...)>&) noexcept;      #include <functional>  #include <cstdlib>  #include <cassert>   +#include "test_macros.h"  #include "count_new.hpp"    class A @@ -63,6 +64,9 @@  {  std::function<int(int)> f1 = A(1);  std::function<int(int)> f2 = A(2); +#if TEST_STD_VER >= 11 + static_assert(noexcept(swap(f1, f2)), "" ); +#endif  assert(A::count == 2);  assert(globalMemCounter.checkOutstandingNewEq(2));  assert(f1.target<A>()->id() == 1); @@ -78,6 +82,9 @@  {  std::function<int(int)> f1 = A(1);  std::function<int(int)> f2 = g; +#if TEST_STD_VER >= 11 + static_assert(noexcept(swap(f1, f2)), "" ); +#endif  assert(A::count == 1);  assert(globalMemCounter.checkOutstandingNewEq(1));  assert(f1.target<A>()->id() == 1); @@ -93,6 +100,9 @@  {  std::function<int(int)> f1 = g;  std::function<int(int)> f2 = A(1); +#if TEST_STD_VER >= 11 + static_assert(noexcept(swap(f1, f2)), "" ); +#endif  assert(A::count == 1);  assert(globalMemCounter.checkOutstandingNewEq(1));  assert(*f1.target<int(*)(int)>() == g); @@ -108,6 +118,9 @@  {  std::function<int(int)> f1 = g;  std::function<int(int)> f2 = h; +#if TEST_STD_VER >= 11 + static_assert(noexcept(swap(f1, f2)), "" ); +#endif  assert(A::count == 0);  assert(globalMemCounter.checkOutstandingNewEq(0));  assert(*f1.target<int(*)(int)>() == g);